package com.ctg.polling.domain;

import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;
import javax.validation.constraints.NotNull;
import com.ctg.polling.domain.Poll;
import javax.persistence.ManyToOne;
import java.util.Set;
import com.ctg.polling.domain.UserSelection;
import java.util.HashSet;
import javax.persistence.OneToMany;
import javax.persistence.CascadeType;

@RooJavaBean
@RooToString
@RooEntity(finders = { "findChoicesByPoll", "findChoicesBySelections" })
public class Choice {

    @NotNull
    private java.lang.String label;

    @ManyToOne
    private Poll poll;

    @NotNull
    @OneToMany(cascade = CascadeType.ALL)
    private Set<UserSelection> selections = new HashSet<UserSelection>();
}
